using System;
using UnityEngine;

namespace AGame.TabOrm.TabOrmAttributeExpand
{
    public class TextFormatTabField : TabField
    {
        public override Func<string, object> GetStrToObjFunc(Type tabType, Type targetType)
        {
            return str => str?.Replace("\\r\\n", "\n")
                .Replace("\\n","\n");
        }

        public override Func<object, string> GetObjToStrFunc(Type tabType, Type targetType)
        {
            return str => str?.ToString()
                .Replace("\r\n", "\\n")
                .Replace("\n","\\n");
        }
    }
}